window: Fallback to CSD titlebar in focus-chain
authorAndrea Azzarone <azzaronea@gmail.com>
Thu, 26 Jul 2018 08:16:32 +0000 (10:16 +0200)
committerAndrea Azzarone <andrea.azzarone@canonical.com>
Mon, 30 Jul 2018 07:30:26 +0000 (09:30 +0200)
CSD titlebar are included in the focus-chain. The logic used makes sure that the
initial focus avoids the titlebar, but tabbing around will eventually get there.
This logic fails in case the window has no other focusable widgets apart from
the ones in the header-bar. If this happens keynav focus will be lost. To handle
the above scenario, we need to fallback to focus the header-bar (if any).

Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/404
gtk/gtkwindow.c

index be734c1d147e80563c72a065f4893c25aa106bcc..2c5e9feaf2eeb84ae030d40c7c0ea1db3ca40603 100644 (file)
@@ -7689,6 +7689,11 @@ gtk_window_focus (GtkWidget        *widget,
     {
       if (gtk_widget_child_focus (child, direction))
         return TRUE;
+      else if (priv->title_box != NULL &&
+               priv->title_box != child &&
+               gtk_widget_child_focus (priv->title_box, direction))
+        return TRUE;
+
     }
 
   return FALSE;